<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Tetris: board.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Tetris
   
   </div>
   <div id="projectbrief">Um jogo do tipo tetris</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">board.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ﻿#ifndef BOARD_H
<a name="l00002"></a>00002 <span class="preprocessor">#define BOARD_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;QList&gt;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;QGraphicsView&gt;</span>
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;cstdlib&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;ctime&gt;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;piece.h&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;level.h&quot;</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;QDebug&gt;</span>
<a name="l00026"></a>00026 
<a name="l00027"></a><a class="code" href="class_board.html">00027</a> <span class="keyword">class </span><a class="code" href="class_board.html" title="Classe do tipo Board.">Board</a>: <span class="keyword">public</span> QGraphicsScene
<a name="l00028"></a>00028 {
<a name="l00029"></a>00029 <span class="keyword">public</span>:       
<a name="l00033"></a>00033     <a class="code" href="class_board.html#a9ee491d4fea680cf69b033374a9fdfcb" title="Construtor padrão classe Board.">Board</a>();
<a name="l00037"></a>00037     <a class="code" href="class_board.html#af73f45730119a1fd8f6670f53f959e68" title="Destrutor padrão classe Board.">~Board</a>();
<a name="l00042"></a><a class="code" href="class_board.html#a9c39cd47355ff518c21b94c0db920ecf">00042</a>     <span class="keywordtype">int</span> <a class="code" href="class_board.html#a9c39cd47355ff518c21b94c0db920ecf" title="Função membro pública da classe Board para obter a pontuação total.">getScore</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_Score;}
<a name="l00047"></a><a class="code" href="class_board.html#a716c5f0db30e1ff230a9f92f50a659fe">00047</a>     <a class="code" href="class_level.html" title="Classe do tipo Level.">Level</a> <a class="code" href="class_board.html#a716c5f0db30e1ff230a9f92f50a659fe" title="Função membro pública da classe Board para obter um objeto do tipo Level que contém as informações do...">getLevel</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_Level;}
<a name="l00052"></a><a class="code" href="class_board.html#ac63395b1aebcae7fdd744b18de8c1f20">00052</a>     QGraphicsScene* <a class="code" href="class_board.html#ac63395b1aebcae7fdd744b18de8c1f20" title="Função membro pública da classe Board para obter um ponteiro para um QGraphicsScene que conterá o des...">getNextPieceScene</a>() {<span class="keywordflow">return</span> m_NextPieceScene;}
<a name="l00057"></a><a class="code" href="class_board.html#ab647ccf386b7a788ec8a1e19616abf88">00057</a>     <span class="keywordtype">bool</span> <a class="code" href="class_board.html#ab647ccf386b7a788ec8a1e19616abf88" title="Função membro pública da classe Board para obter a situação do jogo.">isGameOver</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_GameOver;}
<a name="l00061"></a>00061     <span class="keywordtype">void</span> <a class="code" href="class_board.html#aba8377fc1b3159d212431997509d3886" title="Função membro pública da classe Board para desenhar aleatóriamente uma imagem de fundo.">setImageBackground</a>();
<a name="l00067"></a>00067     <span class="keywordtype">void</span> <a class="code" href="class_board.html#a7fadc00fcfb1835e6e2189d80c2c53ed" title="Função membro pública da classe Board para escolher uma imagem de fundo.">setImage</a>(QImage img);
<a name="l00071"></a>00071     <span class="keywordtype">void</span> <a class="code" href="class_board.html#a9dfe80a7b225a4490a66072f8788a2bd" title="Função membro pública da classe Board que através do mapeamento utilizado em m_Map redesenha as peças...">redesenheBoard</a>();
<a name="l00075"></a>00075     <span class="keywordtype">void</span> <a class="code" href="class_board.html#a4465574b0d2fde0c43454b8b5afe0f72" title="Função membro pública da classe Board que verifica se é possível realizar a movimentação de m_PecaAtu...">tryMoveRight</a>();
<a name="l00079"></a>00079     <span class="keywordtype">void</span> <a class="code" href="class_board.html#a0c283e4a28873887dfb3658dc503365d" title="Função membro pública da classe Board que verifica se é possível realizar a movimentação de m_PecaAtu...">tryMoveLeft</a>();
<a name="l00083"></a>00083     <span class="keywordtype">void</span> <a class="code" href="class_board.html#ac0a3e8366d5d4427e7341f4cafba337c" title="Função membro pública da classe Board que verifica se é possível realizar a movimentação de m_PecaAtu...">tryMoveDown</a>();
<a name="l00087"></a>00087     <span class="keywordtype">void</span> <a class="code" href="class_board.html#a0544736a36f2a354956bf5c685eec356" title="Função membro pública da classe Board que verifica se é possível realizar a rotação de m_PecaAtual...">tryRotation</a>();
<a name="l00091"></a>00091     <span class="keywordtype">void</span> <a class="code" href="class_board.html#a1e30c56bcfe528b785848cca7684c096" title="Função membro pública da classe Board que sorteia uma nova peça para ser adicionada ao tabuleiro...">randPiece</a>();
<a name="l00095"></a>00095     <span class="keywordtype">void</span> <a class="code" href="class_board.html#aa8329196e902f8fe845af9c4c5d4d1fc" title="Função membro pública da classe Board que limpa o tabuleiro e reinicia a pontuação e o level...">clearData</a>();
<a name="l00096"></a>00096 <span class="keyword">private</span>:
<a name="l00097"></a>00097     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> s_maxX = 250, s_maxY = 350; 
<a name="l00098"></a>00098     <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> s_VSqm = 14, s_HSqm = 10;   
<a name="l00099"></a>00099     <span class="keywordtype">int</span> m_Score;                                 
<a name="l00100"></a>00100     <span class="keywordtype">int</span> m_NextPieceIndex;                        
<a name="l00101"></a>00101     <span class="keywordtype">bool</span> m_GameOver;                             
<a name="l00102"></a>00102     <a class="code" href="class_piece.html" title="Classe abstrata do tipo Piece.">Piece</a> *m_PecaAtual;                          
<a name="l00103"></a>00103     <a class="code" href="class_piece.html" title="Classe abstrata do tipo Piece.">Piece</a> *m_NextPiece;                          
<a name="l00104"></a>00104     QGraphicsScene *m_NextPieceScene;            
<a name="l00105"></a>00105     QPair&lt;bool,QColor&gt; m_Map[s_VSqm][s_HSqm];    
<a name="l00106"></a>00106     <a class="code" href="class_level.html" title="Classe do tipo Level.">Level</a> m_Level;                               
<a name="l00112"></a>00112     <span class="keywordtype">int</span>  randPieceIndex();
<a name="l00119"></a>00119     <a class="code" href="class_piece.html" title="Classe abstrata do tipo Piece.">Piece</a>* getRandPiece(<span class="keywordtype">int</span> piece);
<a name="l00125"></a>00125     <span class="keywordtype">bool</span> checkLeftCollision(QList&lt;QRect&gt; &amp;quads);
<a name="l00131"></a>00131     <span class="keywordtype">bool</span> checkRightCollision(QList&lt;QRect&gt; &amp;quads);
<a name="l00137"></a>00137     <span class="keywordtype">bool</span> checkDownCollision(QList&lt;QRect&gt; &amp;quads);
<a name="l00143"></a>00143     <span class="keywordtype">bool</span> checkOverlap(QList&lt;QRect&gt; &amp;quads);
<a name="l00147"></a>00147     <span class="keywordtype">void</span> checkLinhasCompletas();
<a name="l00151"></a>00151     <span class="keywordtype">void</span> checkBoardEmpty();
<a name="l00156"></a>00156     <span class="keywordtype">void</span> tiraLinhaCompleta(<span class="keywordtype">int</span> linha);
<a name="l00157"></a>00157 };
<a name="l00158"></a>00158 
<a name="l00159"></a>00159 <span class="preprocessor">#endif // BOARD_H</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Tue Nov 29 2011 12:33:35 for Tetris by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
